package pdn.sci.cs.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "police_station", catalog = "police_db")
public class PoliceStation implements java.io.Serializable {

	private String id;
	private District district;
	private String name;
	private Integer sortOrder;
	private String insertUserId;
	private String updateUserId;
	private Date insertDatetime;
	private Date updateDatetime;
	private Set devisionalSecretariats = new HashSet(0);

	public PoliceStation() {
	}

	public PoliceStation(String id, District district, String name) {
		this.id = id;
		this.district = district;
		this.name = name;
	}

	public PoliceStation(String id, District district, String name,
			Integer sortOrder, String insertUserId, String updateUserId,
			Date insertDatetime, Date updateDatetime, Set devisionalSecretariats) {
		this.id = id;
		this.district = district;
		this.name = name;
		this.sortOrder = sortOrder;
		this.insertUserId = insertUserId;
		this.updateUserId = updateUserId;
		this.insertDatetime = insertDatetime;
		this.updateDatetime = updateDatetime;
		this.devisionalSecretariats = devisionalSecretariats;
	}

	@Id
	@Column(name = "ID", unique = true, nullable = false, length = 32)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "DISTRICT_ID", nullable = false)
	public District getDistrict() {
		return this.district;
	}

	public void setDistrict(District district) {
		this.district = district;
	}

	@Column(name = "NAME", nullable = false)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "SORT_ORDER")
	public Integer getSortOrder() {
		return this.sortOrder;
	}

	public void setSortOrder(Integer sortOrder) {
		this.sortOrder = sortOrder;
	}

	@Column(name = "INSERT_USER_ID", length = 32)
	public String getInsertUserId() {
		return this.insertUserId;
	}

	public void setInsertUserId(String insertUserId) {
		this.insertUserId = insertUserId;
	}

	@Column(name = "UPDATE_USER_ID", length = 32)
	public String getUpdateUserId() {
		return this.updateUserId;
	}

	public void setUpdateUserId(String updateUserId) {
		this.updateUserId = updateUserId;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "INSERT_DATETIME", length = 19)
	public Date getInsertDatetime() {
		return this.insertDatetime;
	}

	public void setInsertDatetime(Date insertDatetime) {
		this.insertDatetime = insertDatetime;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "UPDATE_DATETIME", length = 19)
	public Date getUpdateDatetime() {
		return this.updateDatetime;
	}

	public void setUpdateDatetime(Date updateDatetime) {
		this.updateDatetime = updateDatetime;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "policeStation")
	public Set getDevisionalSecretariats() {
		return this.devisionalSecretariats;
	}

	public void setDevisionalSecretariats(Set devisionalSecretariats) {
		this.devisionalSecretariats = devisionalSecretariats;
	}

}
